print("====CSDN自动取款机====")
#账户信息
user_data = {
    'Alice': {'password': 'aaa', 'account': 5000},
    'Black': {'password': 'bbb', 'account': 10000},
    'Cindy': {'password': 'ccc', 'account': 15000},
}
#用户界面
while True:
    print('='*12, '欢迎使用ATM系统', '='*12)
    print("请登录：")
    user = input("请输入您的账号：")
    if user in user_data:
        passwd = input("请输入密码：")
        if passwd == user_data[user]['password']:
            while True:
                print('{0:1} {1:10} {2:10}'.format(' ', '1. 余额', '2. 取钱'))
                print('{0:1} {1:10} {2:10}'.format(' ', '3. 存钱', '4. 退出'))
                key = input("请选择您要进行的业务：")
                if key == '1':
                    print('您的余额为：' + str(user_data[user]['account']))
                elif key == '2':
                    saves = input('要取多少钱：')
                    if int(saves) > int(user_data[user]['account']):
                        print("余额不足！")
                    else:
                        saves = int(user_data[user]['account']) - int(saves)
                        del user_data[user]['account']
                        user_data[user]['account'] = saves
                        print('取款成功，现在余额为：' + str(user_data[user]['account']))
                elif key == '3':
                    saves = input('要存多少钱：')
                    saves = int(saves) + int(user_data[user]['account'])
                    del user_data[user]['account']
                    user_data[user]['account'] = saves
                    print('存入成功，现在余额为：' + str(user_data[user]['account']))
                elif key == '4':
                    print('欢迎下次光临!')
                    break
                else:
                    print('输入有误，请重新选择！')
        else:
            print('密码错误!')
    else:
        print('账户不存在！')
